Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make numpydoc lint --ignore ... parsing more robust #560

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

stefanv
Copy link
Contributor

@stefanv stefanv commented May 24, 2024

Before, the only way to specify ignores is as:

  numpydoc lint filename --ignore EX01 SA01

and multiple invocations of the ignore flag overwrote one another.

Instead, ignored checks are now specified as:

  numpydoc lint --ignore=EX01,SA01 filename

The comma can also be whitespace:

  numpydoc lint --ignore="EX01 SA01" filename

Multiple ignore flags work correctly:

  numpydoc lint --ignore EX01 --ignore SA01 filename

@stefmolin Would you be willing to take a look?

Before, the only way to specify ignores is as:

  numpydoc lint filename --ignore EX01 SA01

and multiple invocations of the ignore flag overwrote one another.

Instead, ignored checks are now specified as:

  numpydoc lint --ignore=EX01,SA01 filename

The comma can also be whitespace:

  numpydoc lint --ignore="EX01 SA01" filename

Multiple ignore flags work correctly:

  numpydoc lint --ignore EX01 --ignore SA01 filename
Copy link
Contributor

@rossbar rossbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, though @stefmolin 's opinion would be the most valuable. Thanks @stefanv !

@stefanv
Copy link
Contributor Author

stefanv commented May 24, 2024

I should note that this is backward incompatible (but I don't think we've made a release with the numpydoc lint interface yet?). Specifically:

numpydoc lint foo.py --ignore EX01 SA01

needs to be rewritten as any of the following:

numpydoc lint --ignore EX01,SA01 foo.py  # --ignore can be before or after foo.py
numpydoc lint --ignore=EX01,SA01 foo.py
numpydoc lint --ignore EX01 --ignore SA01 foo.py

@stefmolin
Copy link
Contributor

I'm traveling now, but I will take a look when I'm back later this week.

Copy link
Contributor

@stefmolin stefmolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionality works as expected. I think we are missing a test case for this though (I left a suggestion).

numpydoc/tests/test_main.py Outdated Show resolved Hide resolved
@@ -100,8 +101,6 @@ def _parse_config(s):
)
lint_parser.add_argument(
"--ignore",
type=str,
nargs="*",
help=(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should indicate how this can be used in the help now that there are multiple options.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stefanv WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants